package com.song.conf;

import com.song.servlet.MyServlet;
import com.sun.deploy.config.EmptyConfig;
import com.sun.org.apache.xalan.internal.xsltc.dom.Filter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CharacterEncodingFilter;

import javax.servlet.FilterRegistration;

/**
 * @ClassName : MyConf
 * @Author : 司猫子
 * @Date: 2021/3/1 14:24
 */
@Configuration
public class MyConf {
    @Bean
    public ServletRegistrationBean servletRegistrationBean(){
        MyServlet myServlet = new MyServlet();
        ServletRegistrationBean req = new ServletRegistrationBean(myServlet,"/myservlet");
        return req;

    }

//    @Bean
//    public FilterRegistrationBean filterRegistrationBean(){
//        FilterRegistrationBean filter = new FilterRegistrationBean();
//
//        CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
//        encodingFilter.setEncoding("utf-8");
//        encodingFilter.setForceEncoding(true);
//
//        filter.setFilter(encodingFilter);
//
//        return filter;
//    }
}
